home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Perl Multimedia Cyber Classroom
/
PERL Multimedia Cyber Classroom (Prentice Hall)(1998).ISO
/
install.sh
< prev
next >
Wrap
Linux/UNIX/POSIX Shell Script
|
1998-03-31
|
41KB
|
1,173 lines
#!/bin/sh
#
# $Id$
#
# CyberClassroom installation script.
#
SCRIPT_NAME="$0"
# FUNCTION: cleanup()
#
# DESCRIPTION: To uninstall any aborted attempted install, cleanup the
# "footprints" of any thing the install did to the user's system, and
# return with the specified error code.
#
# ARGUMENTS: $1 - The error code to exit this script with.
#
# GLOBALS: Assumes $UNINSTALL_LINE1 $UNINSTALL_LINE2 $UNINSTALL_LINE3
# $UNINSTALL_LINE4 are set if need be.
#
# RETURN VALUE: NONE
#
cleanup()
{
$ECHO
$ECHO "$SCRIPT_NAME: Installation Aborted, cleaning up..."
$ECHO
$UNINSTALL_LINE1
$UNINSTALL_LINE2
$UNINSTALL_LINE3
$UNINSTALL_LINE4
exit $1
}
# FUNCTION: two_value_question()
#
# DESCRIPTION As a question of the user for input that has 2 allowable
# answers. The first argument is the first allowable answer the user
# can type in and also the default answer if the user just hits the
# enter key. The second argument is the other allowable answer. The
# comparison is case INDEPENDENT, in other words the answer "YeS" is
# the same as "yes". Also the first letter of the answer is all that
# is required, however if the user chooses to type the full allowable
# answer then ONLY the first character is checked, in other words
# "Yasdfa" will be interpreted as a valid "YES".
#
# ARGUMENTS: $1 - first allowable value and also the prompt default
# $2 - Second allowable value
#
# GLOBALS: Assumes $L1 $L2 $L3 $L4 $L5 $L6 $L7 are set if need be.
#
# RETURN VALUE: $PROMPT_ANSWER set a the first character of the
# selected prompt.
#
two_value_question()
{
FIRST_CHAR_OF_ARG1=`$ECHO "$1" | tr "[:lower:]" "[:upper:]" | awk '{print substr($1,1,1)}'`
FIRST_CHAR_OF_ARG2=`$ECHO "$2" | tr "[:lower:]" "[:upper:]" | awk '{print substr($1,1,1)}'`
QUIT_WHILE=0
while [ $QUIT_WHILE -eq 0 ]
do
$ECHO
if [ "$L1" != "" ]; then
$ECHO "$L1"
fi
if [ "$L2" != "" ]; then
$ECHO "$L2"
fi
if [ "$L3" != "" ]; then
$ECHO "$L3"
fi
if [ "$L4" != "" ]; then
$ECHO "$L4"
fi
if [ "$L5" != "" ]; then
$ECHO "$L5"
fi
if [ "$L6" != "" ]; then
$ECHO "$L6"
fi
if [ "$L7" != "" ]; then
$ECHO "$L7"
fi
read A_OR_B
if [ "$A_OR_B" = "" ]; then
A_OR_B=$1
fi
PROMPT_ANSWER=`$ECHO "$A_OR_B" | tr "[:lower:]" "[:upper:]" | awk '{print substr($1,1,1)}'`
if [ "$PROMPT_ANSWER" != "$FIRST_CHAR_OF_ARG1" -a "$PROMPT_ANSWER" != "$FIRST_CHAR_OF_ARG2" ]; then
$ECHO
$ECHO "Please answer with \"$1\" or \"$2\". Try again."
else
QUIT_WHILE=1
fi
done
return 0
}
#
# copy_file_to_file
#
# Takes two arguments as file names for copying. First argument specifies
# source file, the second specifies the destination file. Each argument
# may be prepended with absolute or relative path name. Attempts to
# create any non-existent directories in destination path before copying.
#
# An optional third argument specifies an permissions argument that
# would be passed to a chmod operation on the destination file.
# NOTE: Destination is always taken as a file name, not a directory, unless
# a directory with a name matching the destination exists before the call.
#
copy_file_to_file()
{
$ECHO "Copying $1 to $2 ..."
destdir=`dirname $2`
if [ $? -eq 0 ] ; then mkdir -p $destdir ; fi
if [ $? -eq 0 ] ; then cp -p $1 $2 ; fi
if [ $? -eq 0 -a "$3" != "" ] ; then chmod $3 $2 ; fi
}
#
# copy_file_from_list_to_list
#
# Function takes two arguments as lists of source and destination files
# for copying, respectively. Files in the source list ($1) are copied to
# the corresponding location in the destination list ($2) using the
# copy_file_to_file() function.
#
# An optional third argument is taken as a list of permissions arguments
# that will be applied to the files in the destination list.
#
# Special care should be taken with quoting for forming the lists as single
# arguments. (This is Bourne shell, after all.) Naturally, the lists
# should all be of equal length.
#
copy_file_from_list_to_list()
{
i=1
for srcfile in $1 ; do
destfile=`$ECHO "$2" | awk "{ print \\$$i }"`
destperm=`$ECHO "$3" | awk "{ print \\$$i }"`
copy_file_to_file $srcfile $destfile $destperm
status=$?
if [ $status -ne 0 ] ; then return $status ; fi
i=`expr $i + 1`
done
}
trap '$ECHO;$ECHO "Ctrl-C detected";$ECHO;cleanup 1' 2
SCRIPTDIR=`dirname $0`
# Get the run-time parameters for this install
if [ -f ./install.ini ] ; then
. ./install.ini
elif [ -f $SCRIPTDIR/install.ini ] ; then
. $SCRIPTDIR/install.ini
else
$ECHO "Error: Could not find install.ini file."
cleanup 1
fi
if [ "$CYBERCLASSROOM_CDROOT" != "" ] ; then
# set CDROM root explicitly
CDROM_DIR=$CYBERCLASSROOM_CDROOT
else
# default the CD root to the directory where the script was found
cd $SCRIPTDIR
CDROM_DIR=`/usr/bin/pwd`
fi
# The rest of the script runs relative to the root of the CDROM
cd $CDROM_DIR
UNINSTALL_LINE1=""
UNINSTALL_LINE2=""
UNINSTALL_LINE3=""
UNINSTALL_LINE4=""
printf "%s" "$WELCOME_MSG"
# No arguments required for this script
if [ $# -ne 0 ]; then
$ECHO
$ECHO "Note: no arguments are required for this installation script."
$ECHO "The arguments will be ignored."
$ECHO
fi
# Warning message if the current user is not "root"
user=`id | sed 's/^.*(\(.*\)) .*/\1/'`
groupid=`id | sed 's/gid.*(\(.*\))/\1/' | awk '{print $NF}'`
if [ "$user" != "root" ]; then
L5=""; L6=""; L7=""
L1="WARNING: This installation script creates files and directories "
L2="on local mount points. Unless you have proper file permissions "
L3="the installation may not proceed properly."
L4="Continue installation as user \"$user\" ? (yes|no) [no]: \c"
two_value_question no yes
if [ "$PROMPT_ANSWER" != "Y" ]; then
cleanup 5
fi
$ECHO
fi
INSTALL_JRE=1
JRE_LOCATION=/opt
L2=""; L3=""; L4=""; L5=""; L6=""; L7=""
L1="Do you have the SunSoft JRE installed ? (yes|no) [no]: \c"
two_value_question no yes
if [ "$PROMPT_ANSWER" = "Y" ]; then
while [ 1 ]
do
JRE_LOCATION=/opt
INSTALL_JRE=0
# Ask for the "jre" in the current path
$ECHO
$ECHO "Where is the SunSoft JRE installed ? (ex: \"/opt/apps/jre${CYBERCLASSROOM_JRE_VERSION}\"): \c"
read RESPONSE
if [ "$RESPONSE" = "" ]; then
$ECHO
$ECHO "You must type a location, such as \"/opt/apps/jre${CYBERCLASSROOM_JRE_VERSION}\". Try again."
$ECHO
continue
fi
JRE_LOCATION=$RESPONSE
# Check to see if the user is right
if [ ! -d $JRE_LOCATION ]; then
$ECHO
$ECHO "The directory \"$JRE_LOCATION\" does not exist on your system."
$ECHO "Please try another path."
$ECHO
continue
fi
# OK Now we have the location
JRE_EXECUTABLE=$JRE_LOCATION/bin/jre
# Check for the JRE and run it, make sure it's the version
# CyberClassroom needs or a version
# that is later.
if [ ! -f $JRE_EXECUTABLE ]; then
TMP_JRE_LOCATION=$JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION}
TMP_JRE_EXECUTABLE=$TMP_JRE_LOCATION/bin/jre
if [ ! -f $TMP_JRE_EXECUTABLE ]; then
L5=""; L6=""; L7=""
L1="The executable \"$TMP_JRE_EXECUTABLE\" does not exist "
L2="Maybe there is a damaged installation of a previous JRE."
L3="Do you wish to reinstall the JRE in the directory"
L4="\"$JRE_LOCATION\" ? (yes/no) [yes]: \c"
two_value_question yes no
if [ "$PROMPT_ANSWER" = "Y" ]; then
INSTALL_JRE=1
break
else
L2=""; L3=""; L4=""; L5=""; L6=""; L7=""
L1="Choose another location? (yes/no) [yes]: \c"
two_value_question yes no
if [ "$PROMPT_ANSWER" = "Y" ]; then
continue
else
$ECHO
$ECHO "$0: ERROR: A possibly damaged installation of the JRE was detected"
$ECHO "in the directory \"$JRE_LOCATION\"."
$ECHO "Please correct this problem and run this installation again."
cleanup 15
fi
fi
else
JRE_LOCATION=$TMP_JRE_LOCATION
JRE_EXECUTABLE=$TMP_JRE_EXECUTABLE
fi
fi
CURRENT_JRE=`$JRE_EXECUTABLE -help 2>&1 | grep -i Version | awk '{print $NF}'`
if [ `$ECHO "$CURRENT_JRE" | awk -F. '{print $1$2$3$4}'` -ne `$ECHO "$CYBERCLASSROOM_JRE_VERSION" | awk -F. '{print $1$2$3$4}'` ]; then
L7=""
L1="The JRE executable [$CURRENT_JRE] on your system"
L2="is not the version used by the CyberClassroom JRE "
L3="[jre version \"$CYBERCLASSROOM_JRE_VERSION\"]."
L4="If you are using a version older than this,"
L5="it is recommended you install the CyberClassroom JRE version as well."
L6="Continue and use existing JRE ? (yes/no) [no]: \c"
two_value_question no yes
if [ "$PROMPT_ANSWER" = "Y" ]; then
INSTALL_JRE=0
else
INSTALL_JRE=1
fi
break
else
break
fi
done
fi
# If the JRE needs installing do it now
while [ 1 ]
do
if [ $INSTALL_JRE -eq 1 ]; then
$ECHO
$ECHO "You are about to install the SunSoft JRE version $CYBERCLASSROOM_JRE_VERSION."
$ECHO "Please conform to all licensing agreements."
$ECHO "NOTE: The installer will create a directory named (jre${CYBERCLASSROOM_JRE_VERSION})"
$ECHO " inside the directory you specify. For example, if you specify \"/opt\" in"
$ECHO " response to the prompt below, the JRE will be installed in directory "
$ECHO " \"/opt/jre${CYBERCLASSROOM_JRE_VERSION}\""
$ECHO "Where do we install the SunSoft JRE (full directory path) ? [$JRE_LOCATION]: \c"
read RESPONSE
if [ "$RESPONSE" != "" ]; then
JRE_LOCATION=$RESPONSE
fi
L2=""; L3=""; L4=""; L5=""; L6=""; L7=""
L1="Install SunSoft JRE in directory ($JRE_LOCATION) creating if necessary ? (yes/no) [yes]: \c "
two_value_question yes no
if [ "$PROMPT_ANSWER" = "N" ]; then
L2=""; L3=""; L4=""; L5=""; L6=""; L7=""
L1="Choose another location ? (yes/no) [yes]: \c"
two_value_question yes no
if [ "$PROMPT_ANSWER" = "Y" ]; then
continue
else
cleanup 20
fi
fi
# Check if destination directory exists, remove the whole thing!!!
if [ -d $JRE_LOCATION ]; then
if [ -d $JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION} ]; then
L4=""; L5=""; L6=""; L7=""
L1="The JRE Directory \"$JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION}\" already exists."
L2="To avoid any possible problems, this directory should be cleaned before installation."
L3="Remove all files in $JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION}? (yes/no) [yes]: \c"
two_value_question yes no
if [ "$PROMPT_ANSWER" = "Y" ]; then
rm -rf $JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION}
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"rm -rf $JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION}\""
$ECHO "Unable to remove an old installation of the JRE."
$ECHO
cleanup 25
fi
fi
fi
UNINSTALL_LINE1="rm -rf $JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION}"
else
mkdir -p $JRE_LOCATION
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"mkdir -p $JRE_LOCATION\""
$ECHO "Unable to create a new directory for the JRE."
$ECHO
cleanup 30
fi
UNINSTALL_LINE1="rm -rf $JRE_LOCATION"
fi
cp ./$SOLARIS_JRE_RUNTIME $JRE_LOCATION
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"cp ./$SOLARIS_JRE_RUNTIME $JRE_LOCATION\""
$ECHO "Unable to install JRE."
$ECHO
cleanup 35
fi
chmod a+x $JRE_LOCATION/$SOLARIS_JRE_RUNTIME
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"chmod a+x $JRE_LOCATION/$SOLARIS_JRE_RUNTIME\""
$ECHO "Unable to install JRE."
$ECHO
cleanup 40
fi
(cd $JRE_LOCATION;./$SOLARIS_JRE_RUNTIME)
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"(cd $JRE_LOCATION;./$SOLARIS_JRE_RUNTIME)\""
$ECHO "Unable to install JRE."
$ECHO
cleanup 45
fi
# Remove the local copy of the JRE Runtime
rm -rf $JRE_LOCATION/$SOLARIS_JRE_RUNTIME
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"rm -rf $JRE_LOCATION/$SOLARIS_JRE_RUNTIME\""
$ECHO "Unable to install JRE."
$ECHO
cleanup 50
fi
JRE_LOCATION=$JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION}
fi
break
done
# Now install the actuall CyberClassroom Viewer and accompanying book.
# Ask if the want to install it locally or leave it on the CDROM.
# Check for previous CyberClassroom and remove if older.
# Check to see if there is space to install.
# Finally, write the commands necessary to do the unistallation script.
$ECHO
$ECHO "You are about to proceed with the Cyber Classroom installation."
$ECHO
$ECHO "\"Compact\" Installation requires approximately $CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_MB_FOR_COMPACT MB of disk space."
$ECHO "All of the data files are installed on your local hard disk, EXCEPT"
$ECHO "the audio files, which remain on the CD-ROM. Links to these large"
$ECHO "files are created on your hard drive. This means you MUST have the "
$ECHO "CD-ROM in your CD-ROM drive in order to run the Cyber Classroom."
$ECHO
$ECHO "\"Full\" Installation requires approximately $CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_MB_FOR_FULL MB of disk space."
$ECHO "All of the data files are installed your local hard disk, INCLUDING"
$ECHO "the audio files. You do not need the CD-ROM in your CD-ROM drive"
$ECHO "to run the Cyber Classroom."
$ECHO
L2=""; L3=""; L4=""; L5=""; L6=""; L7=""
L1="Which installation option do you choose ? (Compact/Full) [Compact]: \c"
two_value_question Compact Full
if [ "$PROMPT_ANSWER" = "C" ]; then
INSTALLATION_OPTION="Compact"
else
INSTALLATION_OPTION="Full"
fi
# OK installation type determined lets check disk space
if [ "$INSTALLATION_OPTION" = "Compact" ]; then
CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_K=$CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_K_FOR_COMPACT
else
CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_K=$CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_K_FOR_FULL
fi
$ECHO
$ECHO "Installation Mode \"$INSTALLATION_OPTION\" Chosen....."
$ECHO
while [ 1 ]
do
CYBERCLASSROOM_LOCATION=/opt/CyberClassroom
$ECHO
$ECHO "Note: If you have done previous installation of any CyberClassroom"
$ECHO "product, it is suggested you use the same directory as before."
$ECHO "This will eliminate duplicate copies of the CyberClassroom Viewer"
$ECHO "Where do we install the CyberClassroom (full directory path) ? [$CYBERCLASSROOM_LOCATION]: \c"
read RESPONSE
# if it's not null then don't use the default prompt answer
if [ "$RESPONSE" != "" ]; then
CYBERCLASSROOM_LOCATION=$RESPONSE
fi
# Check to see if the main directory exists
if [ ! -d $CYBERCLASSROOM_LOCATION ]; then
L4=""; L5=""; L6=""; L7=""
L1="The directory you have chosen"
L2="\"$CYBERCLASSROOM_LOCATION\""
L3="does not exist. Create Directory Now ? (yes/no) [yes]: \c"
two_value_question yes no
if [ "$PROMPT_ANSWER" = "Y" ]; then
mkdir -p $CYBERCLASSROOM_LOCATION
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"mkdir -p $CYBERCLASSROOM_LOCATION\""
$ECHO "Unable to create directory <$CYBERCLASSROOM_LOCATION>."
$ECHO
DIR_OK=0
else
UNINSTALL_LINE4="rm -rf $CYBERCLASSROOM_LOCATION"
DIR_OK=1
fi
# Prompt answer as no
else
DIR_OK=0
fi
if [ $DIR_OK -eq 0 ]; then
L2=""; L3=""; L4=""; L5=""; L6=""; L7=""
L1="Choose another location? (yes/no) [yes]: \c"
two_value_question yes no
if [ "$PROMPT_ANSWER" = "Y" ]; then
continue
else
cleanup 55
fi
fi
fi
# Check for required space in the selected CyberClassroom directory. We do this by finding what
# partition this directory is mounted on. (Ex. /export/home/generic/CyberClassroom is on the /export/home
# partition.
$ECHO
$ECHO "Checking Disk Space Requirements....."
$ECHO
CURRENT_LOCATION_K=`df -k $CYBERCLASSROOM_LOCATION | tail -1 | awk '{print $4}'`
if [ $CURRENT_LOCATION_K -le $CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_K ]; then
L5=""; L6=""; L7=""
L1="WARNING: The directory you selected for $INSTALLATION_OPTION CyberClassroom installation "
L2="\"$CYBERCLASSROOM_LOCATION\" only has ${CURRENT_LOCATION_K}K of available space."
L3="in its partition. The CyberClassroom product requires ${CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_K}K of space."
L4="Select Another Location? (yes/no) [yes]: \c"
two_value_question yes no
if [ "$PROMPT_ANSWER" = "N" ]; then
cleanup 60
fi
else
# Space test succeeded
break
fi
done
# Do check for a Previous CyberClassroom Viewer and ask (or recommend) to replace it if is
# identified as an old version
INSTALL_NEW_VIEWING_ENGINE=0
if [ -d $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR ]; then
CURRENT_CYBERCLASSROOM_VERSION=`$JRE_LOCATION/bin/jre -cp $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR/gsl.jar gsl.gui.Classroom -version`
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following script command \"$JRE_LOCATION/bin/jre -cp "
$ECHO "$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR/gsl.jar gsl.gui.Classroom"
$ECHO " -version\" failed."
$ECHO "Unable to determine an existing CyberClassroom Viewer version number."
$ECHO "A new Viewer will be installed to correct the damaged installation."
$ECHO
INSTALL_NEW_VIEWING_ENGINE=1
else
if [ `$ECHO "$CURRENT_CYBERCLASSROOM_VERSION" | awk -F. '{print $1$2$3$4}'` -lt `$ECHO "$CYBERCLASSROOM_VIEWER_VERSION" | awk -F. '{print $1$2$3$4}'` ]; then
L6=""; L7=""
L1="Note: The installation script has determined that you already have a previous installation of"
L2="the CyberClassroom Viewing Engine (i.e. the "$CYBERCLASSROOM_VIEWER_DIR" directory) and determined that its version"
L3="($CURRENT_CYBERCLASSROOM_VERSION) is older than the one being installed now ($CYBERCLASSROOM_VIEWER_VERSION)."
L4="It is STRONGLY recommended that you install the updated version of this viewing engine."
L5="Shall we proceed and install the new CyberClassroom Viewing Engine ? (yes/no) [yes]: \c"
two_value_question yes no
if [ "$PROMPT_ANSWER" = "Y" ]; then
INSTALL_NEW_VIEWING_ENGINE=1
fi
fi
fi
else
INSTALL_NEW_VIEWING_ENGINE=1
fi
if [ $INSTALL_NEW_VIEWING_ENGINE -eq 1 ]; then
if [ -d $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR ]; then
rm -rf $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"rm -rf $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR\""
$ECHO "Unable to remove an old CyberClassroom Viewing Engine."
$ECHO
cleanup 65
fi
fi
$ECHO
$ECHO "Copying Viewer Files....."
$ECHO
cp -R $CYBERCLASSROOM_VIEWER_DIR $CYBERCLASSROOM_LOCATION
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"cp -R $CYBERCLASSROOM_VIEWER_DIR $CYBERCLASSROOM_LOCATION\""
$ECHO "Unable to install an new CyberClassroom Viewing Engine."
$ECHO
cleanup 70
fi
# Set at least write permission so that this directory can be
# removed if the uninstallation is run.
chmod -R u+w $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"chmod -R u+w $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR\""
$ECHO "Unable to install an new CyberClassroom Viewing Engine."
$ECHO
cleanup 72
fi
UNINSTALL_LINE3="rm -rf $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR"
fi
# Now, install the book checking for "Compact" or "Full" Installation
# If already there, then remove it first and replace with a new one
INSTALL_NEW_BOOK_DIR=0
if [ -d $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR ]; then
L5=""; L6=""; L7=""
L1="Note: The installation script has determined that you already"
L2="have a previous installation of the CyberClassroom Book"
L3="directory \"$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR\"."
L4="Should we reinstall over this directory (answer \"no\" to abort this script) ? (yes/no) [yes]: \c"
two_value_question yes no
if [ "$PROMPT_ANSWER" = "Y" ]; then
INSTALL_NEW_BOOK_DIR=1
else
cleanup 73
fi
else
INSTALL_NEW_BOOK_DIR=1
fi
if [ $INSTALL_NEW_BOOK_DIR -eq 1 ]; then
if [ -d $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR ]; then
rm -rf $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"rm -rf $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR\""
$ECHO "Unable to remove an old installation of this CyberClassroom book."
$ECHO
cleanup 75
fi
fi
$ECHO
$ECHO "Copying Book Files....."
$ECHO
# First copy the contents of the book directory without the jar
# files, zip files and answers directory. Using cpio method creates
# the main directory as well as the sub directories if necessary.
# The users custom umask could subtract write permission from us, therefor
# try and add if for the tar command below, then restore it.
old_mask=`umask`
umask 0000
tar cvf - `ls -d $CYBERCLASSROOM_BOOK_DIR/* | egrep -v '\.zip$|\.jar$|\/answers$'` | ( cd $CYBERCLASSROOM_LOCATION; tar xvf - )
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"tar cvf - \`ls -d $CYBERCLASSROOM_BOOK_DIR/* | egrep -v '\.zip$|\.jar$|\/answers$'\` | ( cd $CYBERCLASSROOM_LOCATION; tar xvf - )\""
$ECHO "Unable to install the CyberClassroom book."
$ECHO
cleanup 76
fi
umask $old_mask
# First create the directory tree and set permissions on it
#find $CYBERCLASSROOM_BOOK_DIR -type d-print | cpio -pmd $CYBERCLASSROOM_LOCATION
#status=$?
#if [ $status -eq 0 ] ; then chmod -R u+rw $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR ; fi
#chmod -R u+rw $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR
#if [ $? -ne 0 ]; then
# $ECHO
# $ECHO "$0: ERROR: Failed change permission on book files in $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR"
# $ECHO "Unable to install the CyberClassroom book."
# $ECHO
# cleanup 80
#fi
#status=$?
# Now, if that was OK, copy file files
#if [ $status -eq 0 ]; then find $CYBERCLASSROOM_BOOK_DIR -print | egrep -v '\.zip$|\.jar$|\/answers$' | cpio -pmd $CYBERCLASSROOM_LOCATION ; fi
#status=$?
#if [ $status -ne 0 ]; then
# $ECHO
# $ECHO "$0: ERROR: Failed copying book files to $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR"
# $ECHO "Unable to install the CyberClassroom book."
# $ECHO
# cleanup 80
#fi
# Now copy any "extra" files in the explicit copy lists
if [ "$EXPLICIT_COPY_SOURCE_LIST" != "" ] ; then
full_dest_list=""
for x in $EXPLICIT_COPY_DEST_LIST ; do
full_dest_list="$full_dest_list $CYBERCLASSROOM_LOCATION/$x"
done
copy_file_from_list_to_list "$EXPLICIT_COPY_SOURCE_LIST" "$full_dest_list" "$EXPLICIT_COPY_DEST_PERMS"
if [ $? -ne 0 ]; then
$ECHO
$ECHO "ERROR: Failed to copy files: $EXPLICIT_SOURCE_LIST"
$ECHO "Unable to install the CyberClassroom book file ($CYBERCLASSROOM_BOOK_FILE)."
$ECHO
cleanup 82
fi
fi
UNINSTALL_LINE2="$UNINSTALL_LINE2 rm -rf $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR"
# For a "Full" installation, copy the jar and zip files along with the answers directory.
if [ "$INSTALLATION_OPTION" = "Full" ]; then
tar cvf - `ls -d $CYBERCLASSROOM_BOOK_DIR/*.jar $CYBERCLASSROOM_BOOK_DIR/*.zip $CYBERCLASSROOM_BOOK_DIR/answers` | ( cd $CYBERCLASSROOM_LOCATION; tar xvf - )
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"tar cvf - \`ls $CYBERCLASSROOM_BOOK_DIR/*.jar\` | ( cd $CYBERCLASSROOM_LOCATION; tar xvf - )\""
$ECHO "Unable to install the CyberClassroom book file ($CYBERCLASSROOM_BOOK_FILE)."
$ECHO
cleanup 83
fi
fi
# tar maintains the user id and group id of the tar creator,
# therefore, change them both to the user whose doing the install.
chown -R $user $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "chown -R $user $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR"
$ECHO "Unable to install the CyberClassroom book."
$ECHO
cleanup 84
fi
chgrp -R $groupid $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "chgrp -R $groupid $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR"
$ECHO "Unable to install the CyberClassroom book."
$ECHO
cleanup 85
fi
# Remember, if root installs to a system directory and any other user run from there, then
# were gonna need write permission on the book directory for "others" because thats where the
# "go.sh" file gets extracted and written. Just to be safe, lets give the book
# directory 755 permission.
chmod -R 755 $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"chmod -R 755 $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR\""
$ECHO "Unable to install the CyberClassroom book."
$ECHO
cleanup 86
fi
# *******************************************
# MEGA KLUDGE!!!!!!!!!!!!!
# *******************************************
# To execute the programs, for some reason the viewer extracts
# the shell files and executable file into the MAIN CyberClassroom (/opt/CyberClassroom)
# directory instead of the CyberClassroom book directory. Therefore,
# we need global write permission on the CyberClassroom directory in the situation
# where root does the install (like in directory /opt/CyberClassroom) and a user
# runs it from there.
chmod a+w $CYBERCLASSROOM_LOCATION
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"chmod 755 $CYBERCLASSROOM_LOCATION\""
$ECHO "Unable to install the CyberClassroom book."
$ECHO
cleanup 99
fi
$ECHO
$ECHO "Making Setup Files....."
$ECHO
# Make sure the "$CYBERCLASSROOM_BOOK_DIR/webdb.ini" file is
# properly initialized by recreating it here with its default
# values. Also make sure its writtable by any user.
#
rm -f $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_INITIALIZATION_FILE
cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_INITIALIZATION_FILE
0
0
0
true
EOF
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_INITIALIZATION_FILE\""
$ECHO "Unable to create the default setup file ($CYBERCLASSROOM_INITIALIZATION_FILE) for the CyberClassroom book."
$ECHO
cleanup 100
fi
chmod a+w $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_INITIALIZATION_FILE
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"chmod a+w $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_INITIALIZATION_FILE\""
$ECHO "Unable to change permissions on the default setup file for the CyberClassroom book."
$ECHO
cleanup 105
fi
# Create the "$CYBERCLASSROOM_HTML_FILE" file based on the
# installation option.
rm -f $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE
cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE
<hr>
<applet code=gsl.gui.Starter width=621 height=421>
EOF
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE\""
$ECHO "Unable to create main html file for the CyberClassroom book."
$ECHO
cleanup 110
fi
if [ "$INSTALLATION_OPTION" = "Full" ]; then
cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE
<param name=gmlarch value="$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_FILE;$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/figures.jar;$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/intro.zip;$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/examples.jar;$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/code.jar;$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/bckgrnds.jar;$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/audio.zip">
EOF
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE\""
$ECHO "Unable to create main html file for the CyberClassroom book."
$ECHO
cleanup 111
fi
else
cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE
<param name=gmlarch value="$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_FILE;$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/figures.jar;$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/intro.zip;$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/examples.jar;$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/code.jar;$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/bckgrnds.jar;$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/audio.zip">
EOF
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE\""
$ECHO "Unable to create main html file for the CyberClassroom book."
$ECHO
cleanup 112
fi
fi
cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE
<param name=book value="$CYBERCLASSROOM_BOOK_NAME.gmlb">
<param name=lastindex value=17>
<param name=fontsize value="16">
<param name=starter value="gsl.gui.perl.PerlStarter">
<param name=aliases value="jarexe=xterm -e /bin/sh ">
</applet>
<hr>
EOF
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE\""
$ECHO "Unable to create main html file for the CyberClassroom book."
$ECHO
cleanup 113
fi
fi # if [ $INSTALL_NEW_BOOK_DIR -eq 1 ]
# Now, build the script which will launch the CyberClassroom product
# for the user Again, make sure that its executable by every user.
cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_SCRIPT
PATH=$JRE_LOCATION/bin:/usr/openwin/bin:$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR:$PATH
export PATH
jre -cp $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR/gsl.jar:$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR/ism.jar:$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR/ui.jar:$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR/search.jar gsl.gui.Classroom file://$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE &
EOF
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_SCRIPT\""
$ECHO "Unable to create startup script for the CyberClassroom book."
$ECHO
cleanup 120
fi
chmod a+x $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_SCRIPT
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"chmod a+x $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_SCRIPT\""
$ECHO "Unable to create startup script for the CyberClassroom book."
$ECHO
cleanup 125
fi
# Build a script for uninstallation operation
cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT
#!/bin/sh
QUIT_WHILE=0
while [ \$QUIT_WHILE -eq 0 ]
do
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "WARNING: This Prentice Hall CyberClassroom uninstallation script"
$ECHO_FOR_UNINSTALL "will run several system remove commands with verification (assuming you"
$ECHO_FOR_UNINSTALL "have file permissions to do so of course):"
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "It is recommended that you move this script to a location (such as /tmp) other"
$ECHO_FOR_UNINSTALL "than a CyberClassroom related directory. By default, this script is installed"
$ECHO_FOR_UNINSTALL "in the main CyberClassroom directory. Since this uninstallation script gives"
$ECHO_FOR_UNINSTALL "you the option to remove the main CyberClassroom directory in which it resides,"
$ECHO_FOR_UNINSTALL "you must move this script from there in order for the system remove command to succeed."
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "Do you want to continue ? (yes|no) [no]: \c"
read YES_OR_NO
if [ "\$YES_OR_NO" = "" ]; then
YES_OR_NO="no"
fi
PROMPT_ANSWER=\`$ECHO_FOR_UNINSTALL "\$YES_OR_NO" | tr "[:lower:]" "[:upper:]" | awk '{print substr(\$1,1,1)}'\`
if [ "\$PROMPT_ANSWER" != "Y" -a "\$PROMPT_ANSWER" != "N" ]; then
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "Please answer with \\"yes\\" or \\"no\\". Try again."
else
QUIT_WHILE=1
fi
done
if [ "\$PROMPT_ANSWER" != "Y" ]; then
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "Uninstallation Aborted."
$ECHO_FOR_UNINSTALL
exit 1
fi
EOF
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT\""
$ECHO "Unable to create uninstallation script for the CyberClassroom book."
$ECHO
cleanup 130
fi
if [ "$UNINSTALL_LINE2" != "" ]; then
cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT
QUIT_WHILE=0
while [ \$QUIT_WHILE -eq 0 ]
do
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "Remove the CyberClassroom book directory with the system remove command(s):"
$ECHO_FOR_UNINSTALL "\\"$UNINSTALL_LINE2\\" ? (yes/no) [yes]: \c"
read YES_OR_NO
if [ "\$YES_OR_NO" = "" ]; then
YES_OR_NO="yes"
fi
PROMPT_ANSWER=\`$ECHO_FOR_UNINSTALL "\$YES_OR_NO" | tr "[:lower:]" "[:upper:]" | awk '{print substr(\$1,1,1)}'\`
if [ "\$PROMPT_ANSWER" != "Y" -a "\$PROMPT_ANSWER" != "N" ]; then
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "Please answer with \\"yes\\" or \\"no\\". Try again."
else
QUIT_WHILE=1
fi
done
if [ "\$PROMPT_ANSWER" != "N" ]; then
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "$UNINSTALL_LINE2"
$UNINSTALL_LINE2
fi
EOF
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"cat << EOF > >$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT\""
$ECHO "Unable to create uninstallation script for the CyberClassroom book."
$ECHO
cleanup 135
fi
fi
if [ "$UNINSTALL_LINE3" != "" ]; then
cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT
QUIT_WHILE=0
while [ \$QUIT_WHILE -eq 0 ]
do
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "(WARNING: If you answer yes to the following question, previous CyberClassroom"
$ECHO_FOR_UNINSTALL "products may no longer work !!!)"
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "Remove the CyberClassroom viewing engine directory with the system remove command:"
$ECHO_FOR_UNINSTALL "\\"$UNINSTALL_LINE3\\" ? (yes/no) [yes]: \c"
read YES_OR_NO
if [ "\$YES_OR_NO" = "" ]; then
YES_OR_NO="yes"
fi
PROMPT_ANSWER=\`$ECHO_FOR_UNINSTALL "\$YES_OR_NO" | tr "[:lower:]" "[:upper:]" | awk '{print substr(\$1,1,1)}'\`
if [ "\$PROMPT_ANSWER" != "Y" -a "\$PROMPT_ANSWER" != "N" ]; then
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "Please answer with \\"yes\\" or \\"no\\". Try again."
else
QUIT_WHILE=1
fi
done
if [ "\$PROMPT_ANSWER" != "N" ]; then
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "$UNINSTALL_LINE3"
$UNINSTALL_LINE3
fi
EOF
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"cat << EOF > >$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT\""
$ECHO "Unable to create uninstallation script for the CyberClassroom book."
$ECHO
cleanup 140
fi
fi
if [ "$UNINSTALL_LINE4" != "" ]; then
cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT
QUIT_WHILE=0
while [ \$QUIT_WHILE -eq 0 ]
do
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "(WARNING: If you answer yes to the following question, previous CyberClassroom"
$ECHO_FOR_UNINSTALL "products may also be removed !!!)"
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "Remove the entire CyberClassroom directory with system remove command:"
$ECHO_FOR_UNINSTALL "\\"$UNINSTALL_LINE4\\" ? (yes/no) [no]: \c"
read YES_OR_NO
if [ "\$YES_OR_NO" = "" ]; then
YES_OR_NO="no"
fi
PROMPT_ANSWER=\`$ECHO_FOR_UNINSTALL "\$YES_OR_NO" | tr "[:lower:]" "[:upper:]" | awk '{print substr(\$1,1,1)}'\`
if [ "\$PROMPT_ANSWER" != "Y" -a "\$PROMPT_ANSWER" != "N" ]; then
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "Please answer with \\"yes\\" or \\"no\\". Try again."
else
QUIT_WHILE=1
fi
done
if [ "\$PROMPT_ANSWER" != "N" ]; then
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "$UNINSTALL_LINE4"
$UNINSTALL_LINE4
fi
EOF
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT\""
$ECHO "Unable to create uninstallation script for the CyberClassroom book."
$ECHO
cleanup 145
fi
fi
# Add the uninstallation option to the uninstall script if
# this installation did infact install the JRE.
if [ "$UNINSTALL_LINE1" != "" ]; then
cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT
QUIT_WHILE=0
while [ \$QUIT_WHILE -eq 0 ]
do
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "(WARNING: If you answer yes to the following question, previous CyberClassroom"
$ECHO_FOR_UNINSTALL "products may no longer execute properly !!!)"
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "Remove the entire JRE directory with system remove command"
$ECHO_FOR_UNINSTALL "\\"$UNINSTALL_LINE1\\" ? (yes/no) [no]: \c"
read YES_OR_NO
if [ "\$YES_OR_NO" = "" ]; then
YES_OR_NO="no"
fi
PROMPT_ANSWER=\`$ECHO_FOR_UNINSTALL "\$YES_OR_NO" | tr "[:lower:]" "[:upper:]" | awk '{print substr(\$1,1,1)}'\`
if [ "\$PROMPT_ANSWER" != "Y" -a "\$PROMPT_ANSWER" != "N" ]; then
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "Please answer with \\"yes\\" or \\"no\\". Try again."
else
QUIT_WHILE=1
fi
done
if [ "\$PROMPT_ANSWER" != "N" ]; then
$ECHO_FOR_UNINSTALL
$ECHO_FOR_UNINSTALL "$UNINSTALL_LINE1"
$UNINSTALL_LINE1
fi
EOF
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT\""
$ECHO "Unable to create uninstallation script for the CyberClassroom book."
$ECHO
cleanup 150
fi
fi
# add an extra $ECHO line to the uninstall script
cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT
$ECHO_FOR_UNINSTALL
EOF
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT\""
$ECHO "Unable to create uninstallation script for the CyberClassroom book."
$ECHO
cleanup 155
fi
# make the uninstall script executable
chmod a+x $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT
if [ $? -ne 0 ]; then
$ECHO
$ECHO "$0: ERROR: following system command failed:"
$ECHO "\"chmod a+x $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT\""
$ECHO "Unable to create uninstallation script for the CyberClassroom book."
$ECHO
$ECHO "Installation Aborted, cleaning up..."
$ECHO
cleanup 160
fi
# Finalization screen
$ECHO
$ECHO "The Prentice Hall Perl Multimedia CyberClassroom has been sucessfully installed!"
$ECHO "Change your directory to \"$CYBERCLASSROOM_LOCATION\""
$ECHO "(cd $CYBERCLASSROOM_LOCATION) and execute the script"
$ECHO "\"$CYBERCLASSROOM_BOOK_SCRIPT\" (./$CYBERCLASSROOM_BOOK_SCRIPT) to run the program."
$ECHO